home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-11-20 | 3.8 KB | 139 lines | [TEXT/R*ch] |
- Flame - 0.9
- by Kyle Ellrott
- garage@wave.net
- -----
- This is a very simple set of subprograms that will allow you to create flame
- effects. What more can I say, it lets you burn things.
-
- --
- There are some simple functions that you should know if you want to
- use this library.
-
- --
- OSErr SetUpFlames(CTabHandle flamePalette, CTabHandle destPalette,
- Rect *bounds, char speed, FlamePtr *theFlame);
-
- You call this to set up your new flame.
-
- flamePalette - This is the values that the flame goes through as it goes
- through each value. You should start with the ash color, which is also
- the clear color, for the MaskFlame function. As the values acsend, so should
- your colors. The last color, number 255 should be the color of hottest flame.
-
- destPalette - This is the pallete for where you plan to draw the flame. The
- destination must be an 8-bit pixmap.
-
- bounds - The size of the destination.
-
- speed - This is the allows you to speed up the flames, if you want to.
- The different speed ups are: noSpeedUp, lowRes2, and lowRes4.
- lowRes2 & lowRes4 simply increase the size of the pixels in the flames.
- This doesn't hurt the quality of the image that much, but anything that you
- throw in the fire is also increased in size.
-
- theFlame - This is the data structure that you will be altering later on.
-
-
- --
- void KillFlames(FlamePtr *theFlame);
-
- Call this to dispose of the memory taken up by theFlame.
-
-
- --
- void ChuckInFire(short x, short y, PixMapPtr victim, FlamePtr theFlame);
-
- You can throw somebody that you don't like into the flames, and then watch
- them burn.
-
- x , y - The location of where the top lefthand corner of the victim should go.
-
- victim - The source image. This must be a 8-bit pixmap.
-
- theFlame - The firey inferno you wish to throw your victim into.
-
-
- --
- void Spark(short x, short y, unsigned char heat, FlamePtr theFlame);
-
- Draw a dot of light in the blaze. You can use this do draw custom designs
- into the flame.
-
- x , y - The location
-
- heat - The value of the pixel.
-
- theFlame - The fire that you are drawing into.
-
-
- --
- void SetUpBurn(unsigned char odds, unsigned char max,
- unsigned char min, FlamePtr theFlame);
-
- This draws several pixels at the bottom of the fire place, giving you a fire source.
-
- odds - How often will it happen, out of 255.
-
- max - The maximum length of a 'log'.
-
- min - The minimum length of a 'log'. Note: I didn't do much error checking, so
- min better be less then max.
-
- theFlame - The fire that you are helping to burn.
-
-
- --
- void Burn (FlamePtr theFlame, unsigned char takeOff, Boolean fuzz);
-
- This is the heart of the program. It is the sub-program that actually
- burns things.
-
- theFlame - The fire that is burning.
-
- takeOff - How much should the flame diminish as it travels upward.
-
- fuzz - If you pass a true, it will randomly variate the takeOff value.
- I put it in to get rid of the plazma look, and give it more of a camp
- fire look, but it doesn't help much. I plan to get rid of it in favor
- of other possible variations.
-
-
- --
- void CopyFlame(short x, short y, FlamePtr theFlame, PixMapPtr dest);
-
- This draws the flame directly into the destination.
-
- x , y - The dest location
-
- theFlame - The fire that you are drawing.
-
- dest - The pixmap that you are drawing to. This must be an 8-bit pixmap.
-
-
- --
- void MaskFlame(short x, short y, FlamePtr theFlame, PixMapPtr dest);
-
- Same thing as CopyFlame, but it doesn't draw the clear color.
-
-
- --
- Plans for the future:
-
- - Work in other other color types then just 8-bit indexed
- - A sin wave variation on the flame path
- - Some assembly to speed up key parts
- - Just make it faster
- - Burn down a building
-
- --
- Legal junk
- I coded this as a practice, and also because I like to burn things.
- All I really want is a nice mention in any program that you use this
- in, and maybe a nice e-mail, that I can burn.
-
- Kyle Ellrott
- garage@wave.net
-
- 'Fire!! Fire!! Ehh, Ehh'
- Beavis and Butthead
-